package org.dreamwork.jasmine2.web.controls;

import org.dreamwork.jasmine2.events.EventException;
import org.dreamwork.util.StringUtil;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by seth.yang on 2019/3/7
 */
public class TextView extends Label {
    private boolean escape = true;

    @Override
    public void render (PrintWriter writer) throws IOException, EventException {
        if (!visible) return;

        writer.print (StringUtil.isEmpty (text) ? "" : escape ? StringUtil.escapeXML (text) : text);
    }

    public boolean isEscape () {
        return escape;
    }

    public void setEscape (boolean escape) {
        this.escape = escape;
    }
}